package com.alpha.feign.common;

import com.alpha.core.http.Response;
import com.alpha.feign.common.entity.Dictionary;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 字典对外接口
 *
 * @author chenruwan
 * @since 2022-01-01
 */
@FeignClient(value = "alpha-common", contextId = "dictionary")
public interface DictionaryFeignClient {
    /**
     * 查询字典列表
     *
     * @return 字典列表
     */
    @GetMapping("/dictionaries")
    Response<Page<Dictionary>> query();

    /**
     * 批量新增或更新字典
     *
     * @param dictionaries 字典列表
     * @return Response
     */
    @PutMapping("/dictionaries")
    Response<Object> saveOrUpdate(@RequestBody List<Dictionary> dictionaries);
}
